package com.coin.controller;

import com.coin.model.*;
import com.coin.service.LoginService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: 李 力
 * @Date: 2025/6/9
 * @Description: com.coin.controller
 * @version: 1.0
 */
@RestController
@Api(tags = "登录的控制器")
@RequestMapping
public class LoginController {

    @Autowired
    private LoginService loginService;

    /**
     * @Description: 会员的登录
     * @Author: 李 力
     * @Date: 2025/6/9
     * @Param: loginForm
     * @return: R
     */
    @PostMapping("/login")
    @ApiOperation(value = "会员的登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "loginForm", value = "登录的表单参数")
    })
    public R<LoginUser> login(@RequestBody @Validated LoginForm loginForm) {
        LoginUser loginUser = loginService.login(loginForm);
        return R.ok(loginUser);
    }
}
